package com.ethink.order.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ethink.order.api.info.PurchaseOrderDetailInfo;
import com.ethink.order.api.info.PurchaseOrderInfo;
import com.ethink.order.api.info.PurchaseOrderSaleInfo;
import com.ethink.order.api.model.*;
import com.ethink.order.api.request.*;
import com.ethink.order.api.response.OverseasDeleveryPreQueryResponse;
import com.ethink.order.api.response.PurchaseOrderDetailQueryResponse;
import com.ethink.order.api.response.TransferPurchaseResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 采购单 Facade接口
 *
 * @author default
 * @date 2022-10-31
 */
@FeignClient(name = "ethink-order-service", path = "order-service/facade/v1/purchaseOrder", contextId = "purchaseOrderFacade")
public interface PurchaseOrderFacade {

    @GetMapping("/queryPurchaseDetailOrderByDetailOrderNo")
    @ResponseBody
    List<PurchaseOrderDetailInfo> queryPurchaseDetailOrderByDetailOrderNo(@RequestParam("detailOrderNo") String detailOrderNo);

    @PostMapping("/purchaseQuote")
    @ResponseBody
    void purchaseQuote(@RequestBody PurchaseQuoteRequest request);

    @PostMapping("/transfer")
    @ResponseBody
    TransferPurchaseResponse transfer(@RequestBody TransferPurchaseOrderRequest request);

    @PostMapping("/add")
    @ResponseBody
    void add(@RequestBody PurchaseOrderAddRequest request);

    @PostMapping("/queryPrePurchaseOrder")
    @ResponseBody
    List<PurchaseOrderDetailModel> queryPrePurchaseOrder(@RequestBody PrePurchaseOrderQueryRequest request);

    @PostMapping("/queryPurchaseDetail")
    @ResponseBody
    Page<PurchaseOrderDetailModel> queryPurchaseDetail(@RequestBody PurchaseOrderDetailPageQueryRequest request);

    @PostMapping("/purchaseDetailUpdate")
    @ResponseBody
    Integer purchaseDetailUpdate(@RequestBody PurchaseOrderDetailUpdateRequest request);

    @PostMapping("/purchaseOrderPageQuery")
    @ResponseBody
    Page<PurchaseOrderModel> purchaseOrderPageQuery(@RequestBody PurchaseOrderPageQueryRequest request);


    @GetMapping("/purchaseDetailDelete")
    @ResponseBody
    void purchaseDetailDelete(@RequestParam("id") Long id);

    @GetMapping("/queryPurchaseOrderDetail")
    @ResponseBody
    PurchaseOrderDetailQueryResponse queryPurchaseOrderDetail(@RequestParam("id") Long id);

    @PostMapping("/purchaseOrderRefine")
    @ResponseBody
    Integer purchaseOrderRefine(@RequestBody PurchaseOrderRefineRequest refineRequest);

    @PostMapping("/purchaseOrderUpdate")
    @ResponseBody
    Integer purchaseOrderUpdate(@RequestBody PurchaseOrderUpdateRequest updateRequest);

    @GetMapping("/purchaseOrderVoid")
    @ResponseBody
    Integer purchaseOrderVoid(@RequestParam("id") Long id);

    @GetMapping("/overseasDeliveryPreQuery")
    @ResponseBody
    OverseasDeleveryPreQueryResponse overseasDeliveryPreQuery(@RequestParam("id") Long id);

    @PostMapping("/updateStatus")
    @ResponseBody
    void updateStatus(@RequestBody PurchaseOrderUpdateStatusRequest updateStatusRequest);

    @GetMapping("/quote/query")
    @ResponseBody
    List<PurchaseQuoteQueryModel> purchaseQuoteQuery(@RequestParam("detailOrderNo") String detailOrderNo, @RequestParam("createUserCode") String createUserCode);

    @PostMapping("/purchaseWarehouseUpdate")
    @ResponseBody
    Integer purchaseWarehouseUpdate(@RequestBody PurchaseWarehouseUpdateRequest request);

    @PostMapping("/updateLockOrderQty")
    @ResponseBody
    Integer updateLockOrderQty(@RequestBody LockOrderQtyUpdateRequest request);

    @PostMapping("/getPurchaseOrderInfo")
    @ResponseBody
    PurchaseOrderInfo getPurchaseOrderInfo(@RequestParam("orderNo") String orderNo);

    @GetMapping("/queryDetailInfoByDetailId")
    @ResponseBody
    PurchaseOrderDetailInfo queryDetailInfoByDetailId(@RequestParam("id") Long id);

    @GetMapping("/queryMainById")
    @ResponseBody
    PurchaseOrderInfo queryMainById(@RequestParam("id") Long id);

    /**
     * 查询采购数量
     *
     * @param orderNos
     * @return
     */
    @PostMapping("/queryPurchaseQty")
    @ResponseBody
    List<PurchaseOrderNoAndQtyModel> queryPurchaseQty(@RequestBody List<String> orderNos);

    /**
     * 根据采购详情单号查询销售需求
     *
     * @param purchaseDetailOrderNoList
     * @return
     */
    @PostMapping("/listPurchaseOrderDetailSaleDemandOrderNo")
    @ResponseBody
    List<PurchaseOrderSaleInfo> listPurchaseOrderDetailSaleDemandOrderNo(@RequestBody List<String> purchaseDetailOrderNoList);

    @PostMapping("/insertOa")
    @ResponseBody
    void insertOa(@RequestParam("id") Long id);

    /**
     * 采购订单货品模式分页查询
     *
     * @param request
     * @return
     */
    @PostMapping("/purchaseOrderPageModeQuery")
    @ResponseBody
    Page<PurchaseOrderModeModel> purchaseOrderPageModeQuery(@RequestBody PurchaseOrderPageQueryModeRequest request);
}